package com.bh.mapper;

import com.bh.pojo.entry.Role;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;

@Repository
public interface RoleMapper {

    //增
    //查

    List<Role> findAll(@Param("likename") String likename);

    @Select("select u.*, r.*\n" +
            "from user u\n" +
            "         INNER JOIN user_role ur ON u.id = ur.uid\n" +
            "         INNER JOIN role r ON r.rid = ur.rid where u.id=#{value}")
    List<Role> findById(Integer uid);

    @Delete("delete from role_menu where rid=#{value}")
    void deleteRMById(Integer rid);

    void addRM(@Param("rid") Integer rid,@Param("mids") List<Integer> mids);
}

